package com.freecloud.rpc.demo1.client;

import java.lang.reflect.Proxy;

/**
 * @Author: maomao
 * @Date: 2021/8/29 3:00 下午
 */
public class RpcProxyClient {

    public <T> T clientProxy(final Class<T> interfaceClass, final String host, final int port) {
        return (T)Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] {interfaceClass},
            new RemoteInvocationHandler(host, port));
    }
}
